package com.zpz.framework.zpzoauth.web;

import com.github.pagehelper.PageInfo;
import com.zpz.framework.zpzoauth.common.result.ZpzOauthResultMsg;
import com.zpz.framework.zpzoauth.pojo.vo.GetAccessVo;
import com.zpz.framework.zpzoauth.service.ZpzOauthFrameAccessService;
import com.zpz.framework.zpzoauth.pojo.qo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author zhangpanzhi
 * @description 权限及放行权限管理
 * @create 2019-07-16 15:17
 */
@Api(tags = "权限及放行权限管理")
@RestController
@RequestMapping(value = "/zpzOauthAccess")
public class ZpzOauthAccessController {
    @Resource
    private ZpzOauthFrameAccessService zpzOauthFrameAccessService;

    @ApiOperation(value = "获取权限列表（100033） |负责人：zhangpanzhi",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "getAccessQo", value = "参数", paramType = "body", dataType = "GetAccessQo", required = true
            )})
    @PostMapping(value = "/getAccessPageList")
    public ZpzOauthResultMsg<PageInfo<GetAccessVo>> getAccessPageList(HttpServletRequest request, @RequestBody GetAccessQo getAccessQo) throws Exception{
        return zpzOauthFrameAccessService.getAccessPageList(request,getAccessQo);
    }

    @ApiOperation(value = "获取放行权限列表（100042） |负责人：zhangpanzhi",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "getReleaseAccessListQo", value = "参数", paramType = "body", dataType = "GetReleaseAccessListQo", required = true
            )})
    @PostMapping(value = "/getReleaseAccessPageList")
    public ZpzOauthResultMsg<PageInfo<GetAccessVo>> getReleaseAccessPageList(HttpServletRequest request, @RequestBody GetReleaseAccessListQo getReleaseAccessListQo) throws Exception{
        return zpzOauthFrameAccessService.getReleaseAccessPageList(request,getReleaseAccessListQo);
    }

    @ApiOperation(value = "获取权限详情（100043） |负责人：zhangpanzhi",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "getAccessDetailQo", value = "参数", paramType = "body", dataType = "GetAccessDetailQo", required = true
            )})
    @PostMapping(value = "/getAccessDetail")
    public ZpzOauthResultMsg<GetAccessVo> getAccessDetail(HttpServletRequest request, @RequestBody GetAccessDetailQo getAccessDetailQo) throws Exception{
        return zpzOauthFrameAccessService.getAccessDetail(request,getAccessDetailQo);
    }

    @ApiOperation(value = "获取放行权限详情（100044） |负责人：zhangpanzhi",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "getAccessDetailQo", value = "参数", paramType = "body", dataType = "GetAccessDetailQo", required = true
            )})
    @PostMapping(value = "/getReleaseAccessDetail")
    public ZpzOauthResultMsg<GetAccessVo> getReleaseAccessDetail(HttpServletRequest request, @RequestBody GetAccessDetailQo getAccessDetailQo) throws Exception{
        return zpzOauthFrameAccessService.getReleaseAccessDetail(request,getAccessDetailQo);
    }

    @ApiOperation(value = "添加权限信息（100045） |负责人：zhangpanzhi",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "insertAccessQo", value = "参数", paramType = "body", dataType = "InsertAccessQo", required = true
            )})
    @PostMapping(value = "/addAccess")
    public ZpzOauthResultMsg<Boolean> addAccess(HttpServletRequest request, @RequestBody InsertAccessQo insertAccessQo) throws Exception{
        return zpzOauthFrameAccessService.addAccess(request,insertAccessQo);
    }

    @ApiOperation(value = "添加放行权限信息（100046） |负责人：zhangpanzhi",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "insertReleaseAccessQo", value = "参数", paramType = "body", dataType = "InsertReleaseAccessQo", required = true
            )})
    @PostMapping(value = "/addReleaseAccess")
    public ZpzOauthResultMsg<Boolean> addReleaseAccess(HttpServletRequest request, @RequestBody InsertReleaseAccessQo insertReleaseAccessQo) throws Exception{
        return zpzOauthFrameAccessService.addReleaseAccess(request,insertReleaseAccessQo);
    }

    @ApiOperation(value = "修改权限信息（100047） |负责人：zhangpanzhi",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "updateAccessQo", value = "参数", paramType = "body", dataType = "UpdateAccessQo", required = true
            )})
    @PostMapping(value = "/updateAccess")
    public ZpzOauthResultMsg<Boolean> updateAccess(HttpServletRequest request, @RequestBody UpdateAccessQo updateAccessQo) throws Exception{
        return zpzOauthFrameAccessService.updateAccess(request,updateAccessQo);
    }

    @ApiOperation(value = "修改放行权限信息（100048） |负责人：zhangpanzhi",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "updateReleaseAccessQo", value = "参数", paramType = "body", dataType = "UpdateReleaseAccessQo", required = true
            )})
    @PostMapping(value = "/updateReleaseAccess")
    public ZpzOauthResultMsg<Boolean> updateReleaseAccess(HttpServletRequest request, @RequestBody UpdateReleaseAccessQo updateReleaseAccessQo) throws Exception{
        return zpzOauthFrameAccessService.updateReleaseAccess(request,updateReleaseAccessQo);
    }

    @ApiOperation(value = "删除权限信息（100049） |负责人：zhangpanzhi",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "deleteAccessQo", value = "参数", paramType = "body", dataType = "DeleteAccessQo", required = true
            )})
    @PostMapping(value = "/delAccess")
    public ZpzOauthResultMsg<Boolean> delAccess(HttpServletRequest request, @RequestBody DeleteAccessQo deleteAccessQo) throws Exception{
        return zpzOauthFrameAccessService.delAccess(request,deleteAccessQo);
    }

    @ApiOperation(value = "删除放行权限信息（100050） |负责人：zhangpanzhi",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "deleteAccessQo", value = "参数", paramType = "body", dataType = "DeleteAccessQo", required = true
            )})
    @PostMapping(value = "/delReleaseAccess")
    public ZpzOauthResultMsg<Boolean> delReleaseAccess(HttpServletRequest request, @RequestBody DeleteAccessQo deleteAccessQo) throws Exception{
        return zpzOauthFrameAccessService.delReleaseAccess(request,deleteAccessQo);
    }
}
